main() {
  Person person = Person("张三", 18, 1.80, true);
  print(person.name);
  print(person.age);
  print(person.height);
  print(person.isStudent);
  Person person2 = Person.student();
  print(person2.name);
  print(person2.age);
  print(person2.height);
  print(person2.isStudent);
  Person person3 = Person.teacher();
  print(person3.name);
  print(person3.age);
  print(person3.height);
  print(person3.isStudent);
}

class Person {
  String? name;
  int? age;
  double? height;
  bool? isStudent;

  //构造函数（主），与类名同名，唯一
  Person(this.name, this.age, this.height, this.isStudent){
    print("Person构造函数");
  }

  //构造函数（次），与类名同名，可以有多个
  Person.student() {
    name = "张三";
    age = 18;
    height = 1.80;
    isStudent = true;
  }
  Person.teacher() {
    name = "李四";
    age = 20;
    height = 1.85;
    isStudent = false;
  }

//简写构造函数
  Person.student2({this.name, this.age, this.height}): this.isStudent = true;

}
